/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="index_data")
public class IndexData implements Serializable {
	public IndexData() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.IndexClass indexClass;
	
	private String title;
	
	private String image;
	
	private Byte dataType;
	
	private Integer dataId;
	
	private Byte sort;
	
	private String dataName;
	
	private String position;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_INDEXDATA_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_INDEXDATA_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 标题
	 */
	public void setTitle(String value) {
		this.title = value;
	}
	
	/**
	 * 标题
	 */
	@Column(name="title", nullable=true, length=255)	
	public String getTitle() {
		return title;
	}
	
	/**
	 * 图片地址
	 */
	public void setImage(String value) {
		this.image = value;
	}
	
	/**
	 * 图片地址
	 */
	@Column(name="image", nullable=true, length=255)	
	public String getImage() {
		return image;
	}
	
	/**
	 * 数据类型 新闻 
	 */
	public void setDataType(byte value) {
		setDataType(new Byte(value));
	}
	
	/**
	 * 数据类型 新闻 
	 */
	public void setDataType(Byte value) {
		this.dataType = value;
	}
	
	/**
	 * 数据类型 新闻 
	 */
	@Column(name="dataType", nullable=true)	
	public Byte getDataType() {
		return dataType;
	}
	
	/**
	 * 数据id
	 */
	public void setDataId(int value) {
		setDataId(new Integer(value));
	}
	
	/**
	 * 数据id
	 */
	public void setDataId(Integer value) {
		this.dataId = value;
	}
	
	/**
	 * 数据id
	 */
	@Column(name="dataId", nullable=true, length=10)	
	public Integer getDataId() {
		return dataId;
	}
	
	/**
	 * 排序
	 */
	public void setSort(byte value) {
		setSort(new Byte(value));
	}
	
	/**
	 * 排序
	 */
	public void setSort(Byte value) {
		this.sort = value;
	}
	
	/**
	 * 排序
	 */
	@Column(name="sort", nullable=true)	
	public Byte getSort() {
		return sort;
	}
	
	public void setDataName(String value) {
		this.dataName = value;
	}
	
	@Column(name="dataName", nullable=true, length=255)	
	public String getDataName() {
		return dataName;
	}
	
	public void setPosition(String value) {
		this.position = value;
	}
	
	@Column(name="position", nullable=true, length=255)	
	public String getPosition() {
		return position;
	}
	
	public void setIndexClass(cn.imvc.app.entities.IndexClass value) {
		this.indexClass = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.IndexClass.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="indexClassId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.IndexClass getIndexClass() {
		return indexClass;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("IndexData[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getIndexClass() != null)
				sb.append("IndexClass.Persist_ID=").append(getIndexClass().toString(true)).append(" ");
			else
				sb.append("IndexClass=null ");
			sb.append("Title=").append(getTitle()).append(" ");
			sb.append("Image=").append(getImage()).append(" ");
			sb.append("DataType=").append(getDataType()).append(" ");
			sb.append("DataId=").append(getDataId()).append(" ");
			sb.append("Sort=").append(getSort()).append(" ");
			sb.append("DataName=").append(getDataName()).append(" ");
			sb.append("Position=").append(getPosition()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
